package com.hjw.java.abstract_demo1;

/**
 * 金卡，，支付打8折
 * @author hjwStrart
 * @create 2022-01-13 11:02
 */
public class GoldCard extends Card{

    {
        setDiscount(0.80);
    }
    public GoldCard(String noCard, String password, String user, Double balance) {
        super(noCard, password, user, balance);
    }

    @Override
    public Boolean pay(Double paymentAmount) {
        if (getBalance() < paymentAmount * 0.8  || paymentAmount < 0){
            return false;
        }else{
            setBalance( getBalance() - paymentAmount * 0.8 );
            return true;
        }

    }
}
